import React, { Component, Fragment } from 'react'

export default class Child extends Component {
    state = {
        num: 0
    }
    increment = () => {
        this.setState(state => state.num++);
    }
    render() {
        return (
            <Fragment>
                <div className='alert alert-danger'>
                    当前值为：{this.state.num}
                </div>
                <button onClick={this.increment} className='btn btn-primary'>增加</button>
            </Fragment>
        )
    }
}
